import _Comp from "./src/form.vue";

import type { Plugin, App } from "vue";

export type SFCWithInstall<T> = T & Plugin;
export function withInstall<T>(comp: T) {
  (comp as SFCWithInstall<T>).install = function (app: App) {
    const { name } = comp as { name: string };
    if (name) {
      app.component(name, comp as unknown as { name: string });
    }
  };
  return comp as SFCWithInstall<T>;
}

const SnoForm = withInstall(_Comp);

export * from "./src/props";
export { SnoForm };

export default SnoForm;

declare module "vue" {
  export interface GlobalComponents {
    "sno-form": typeof SnoForm;
  }
}
